<script>
	function addsubmit(accept) {
		var accept = accept == 0 ? 0 : 1;
		$.ajax({
 			type: "POST",
 			url: U('group/Group/joinGroup'),
 			data:   "addsubmit=1&gid={$gid}&accept=" + accept + "&reason=" + $('#reason').val(),
 			success: function(msg){
 				if (1 == accept) {
	 				$('#pop1').hide();
	 				$('#pop2').show();
 				} else {
 					ui.box.close();
 				}
 			}
		});
	}
</script>

<php>if ($groupinfo['need_invite'] == 2 && !$is_invited) {</php>
<div style="padding:20px; text-align:center; width:310px;">该群需要邀请才能加入</div>
<php>} else if ($config['joinMaxGroup'] && $joinCount >= $config['joinMaxGroup']) {</php>

<div id="pop" style="width:350px; text-align:left">
  <div style="padding:20px; text-align:center">
		你加入的群太多了！！不可以再加入了！！
        </div>
      <div style="padding-bottom:10px; text-align:center" ><input name="input" type="button" class="btn_b" value="确 定" onclick="ui.box.close()"/></div>
  </div>

<php>} else if (is_numeric($isjoin)) { </php>
<div style="padding:20px;">
	<h3>
		<php>if ($isjoin > 0) {</php>
		你已经加入过！！！
		<php>} else if ($isjoin == 0) { </php>
		请等待审核！！！
		<php>}</php>
	</h3>
</div>
<div  style="padding-bottom:10px; text-align:center">
	<input name="input" type="button" class="btn_b" value="确 定" onclick="ui.box.close()"/>
</div>
<php>} else {</php>
<div id="pop1" style="width:300px; text-align:left">

    <if condition="$groupinfo['need_invite'] eq 1 && !$is_invited">
    <div style="padding:20px;">
需通过该群管理员的审核才能加入该群<br/>
      申请加入理由：<br />
          <textarea name="textarea" class="Text" cols="" name="reason" id="reason" rows="" style="width:100%; height:50px;"></textarea>
    </div>
  	<div style="padding-bottom:10px; text-align:center"><input name="input" type="button" class="btn_b" value="确 定" onclick="addsubmit(1)"/>
          <input name="input2" type="button" class="btn_w" value="取 消" onclick="ui.box.close()"/></div>    
    <else />
	    <if condition="$is_invited">
			<div style="padding:20px; text-align:center">
	    	确定接受“{$groupinfo.name}”管理员的邀请吗？
		    </div>
		    <div  style="padding-bottom:10px; text-align:center"><input name="input" type="button" class="btn_b" value="接 受" onclick="addsubmit(1)"/>
	  		 <input name="input2" type="button" class="btn_w" value="拒 绝" onclick="addsubmit(0)"/></div>
		<else />
			<div style="padding:20px; text-align:center">
				确定要加入“{$groupinfo.name}”吗？
		    </div>
		    <div class="answers"  style="padding-bottom:10px; text-align:center"><input name="input" type="button" class="btn_b" value="确 定" onclick="addsubmit(1)"/>
	  		 <input name="input2" type="button" class="btn_w" value="取 消" onclick="ui.box.close()"/></div>
	    </if>
	</if>

  </div>
<php>} </php>


<div id="pop2" style="display:none; width:350px; text-align:left">
  <div style="padding:20px">
		<eq name="groupinfo['need_invite']" value="1">申请加入“{$groupinfo.name}”成功，请等待审核
		<else />
		你已经加入“{$groupinfo.name}”成功 
		</eq>
    </div>
  <div class="answers" >
          <input type="button" class="btn_b" value="确 定" onclick="javascript:url=parent.location.href; parent.window.location.href=url;ui.box.close();"/>
  </div>
</div>
